package com.scanx.exception;

import com.scanx.enums.ExceptionCode;
import lombok.extern.slf4j.Slf4j;

import java.io.PrintStream;

/**
 * @author alpha.
 * @className ScanException
 * @date 2024/2/6 11:57
 */
@Slf4j
public class ScanException extends RuntimeException {

    private ExceptionCode exception;

    public ScanException(ExceptionCode exception, String message, Throwable cause) {
        super(message, cause);
        this.exception = exception;
    }

    public ScanException(ExceptionCode exception, String message) {
        super(message);
        this.exception = exception;
    }

    public ScanException(String message) {
        super(message);
    }


    @Override
    public void printStackTrace(PrintStream s) {
        log.error("=> 异常码[{}]", exception.code);
        super.printStackTrace(s);
    }

}
